package com.jeehentor.generate.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jeehentor.common.api.GenerateCommonAPI;
import com.jeehentor.generate.entity.SysGenPage;
import com.jeehentor.generate.mapper.SysGenPageMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @Description : 公共接口
 * @Author : wzd
 * @Date : 2024/4/8 14:30
 * @Version : 1.0
 **/
@Slf4j
@Service
@RequiredArgsConstructor
public class GenrateCommonAPIService implements GenerateCommonAPI {

    private final SysGenPageMapper sysGenPageMapper;

    @Override
    public String getPageId(String menuId){
        LambdaQueryWrapper<SysGenPage> sysGenPageLambdaQueryWrapper = new LambdaQueryWrapper<>();
        sysGenPageLambdaQueryWrapper.eq(SysGenPage::getMenuId,menuId);
        SysGenPage sysGenPage = sysGenPageMapper.selectOne(sysGenPageLambdaQueryWrapper);
        if(sysGenPage != null){
            return sysGenPage.getId();
        }
        return null;
    }
}
